#include <REGX52.H>

sbit RCK = P3^5;
sbit SCK = P3^6;
sbit SER = P3^4;


void Delay(unsigned int ms)
{
	unsigned char data i, j;

	while(ms--)
	{
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}
}

void _74hc595_init()
{
	SCK = 0;
	RCK = 0;
}

void _74HC595_write(unsigned char byte)
{
	unsigned char i = 0;
	for(i = 0; i < 8; i++)
	{
		SER = byte & (0x80 >> i);
		SCK = 1;
		SCK = 0;
	}
	RCK = 1;
	RCK = 0;
}

void MatrixLED_showcolumu(unsigned char col,unsigned char Data)
{
	_74HC595_write(Data);
	col -= 1;
	P0 = ~(0x80 >> col);
	delay(20);
	P0 = 0xFF;
}

void main()
{
	_74hc595_init();
	while(1)
	{
		MatrixLED_showcolumu(1,0xaa);
	}
	
}

